<?php
@session_start();
include ("template/head.php");
if($user['account_login']=="user"){
		header('location:list_article.php?action=access_denied');
	}
?>

<div class="container-fluid">
	<div class="row-fluid">
		<?php include("template/menu_left.php")
		?>

		<div class="span9" id="content">
			<div class="row-fluid">
				<?php
				if ((isset($_GET["action"])) && ($_GET["action"] == "user_exist")) {
					echo '
                <br>
                <div class="alert alert-danger">
                    Utilisateurs existe déja <button type="button" class="close" data-dismiss="alert">&times;</button>
                </div>';
				}
				if ((isset($_GET["action"])) && ($_GET["action"] == "user_added")) {
					echo '
                <br>
                <div class="alert alert-success">
                    Utilisateurs ajouté avec succès <button type="button" class="close" data-dismiss="alert">&times;</button>
                </div>';
				}
				?>
				
				

				<!-- block -->
				<div class="block">
					<div class="navbar navbar-inner block-header">
						<div class="muted pull-left">
							<h5>Gestion utilisateurs </h5>
						</div>
					</div>
					<div class="block-content collapse in">
						<div class="span12">
							<table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered"  id="example">
								<thead>
									<tr>
										<th style="width: 300px;" >Adresse email</th>
										<th style="width: 300px;">Mot de passe </th>
										<th style="width: 400px;" >Type d'utilisateurs</th>
										<th style="width: 500px;" >Action</th>
									</tr>
								</thead>
								<tbody>
									<?php
										while ($users = mysql_fetch_array($resultat)) {
									?>
									<tr class="odd gradeX">
										<td> <?php echo $users['email_login']; ?> </td>
										<td> 
											<div class="controls">
												<input type="password" class="validate[required]" value="<?php echo $users['password_login']; ?>"  disabled=""/> </td>
											</div>
										<td> 
											<?php echo $users['account_login']; ?>
										<td>
										
											<a class="btn btn-primary btn-small" href="<?php echo 'user_edit.php?userID='.$users['id_login'].'&user_email='. $users['email_login']; ?>" title="">
												<i class="icon-refresh icon-white"></i>
												Editer</a>
											
											<a class="btn btn-danger btn-small" href="<?php echo '#delete_modal'.$users['id_login'] ; ?>" data-placement="bottom" data-original-title="Help" data-toggle="modal">
											<i class="icon-remove icon-white"></i>	
											Supprimer</a>
											
											<div id="<?php echo 'delete_modal'.$users['id_login'] ; ?>" class="modal hide">

												<div class="modal-header">
													<button data-dismiss="modal" class="close" type="button">&times;</button>
														<p>Vouliez-vous supprimé l'utilisateur : <strong><?php echo $users['email_login']; ?></strong> </p>
													</div>
													<div class="modal-footer">
														<form  method="POST" action="submit/add_user.php?id_user=<?php echo $users['id_login'] ; ?>&action=delete">
														<input class="btn btn-danger" type="submit" value="Valider">
														<a data-dismiss="modal" class="btn" href="#">Annuler</a>
														</form>
													</div>
											</div>
										</td>
									</tr>
									<?php }; ?>
								</tbody>
							</table>
						</div>
					</div>
				</div>
				<!-- /block -->
				<!-- block -->
				<div class="block">
					
					<form id="formAddIntervention" class="form-horizontal" method="post" action="submit/add_user.php">
                    <div class="navbar navbar-inner block-header">
                        <div class="muted pull-left">Ajouter un profil : </div>
                        <!-- .toolbar -->
                    </div>   
                    <div class="block-content in" id="div-1">
                    	<br><br>
                    <div class="control-group">  
                        <label class="control-label span2" for="ref_article">Email utilisateur :</label>
                          <div class="controls">
                            <input type="text"  class="validate[required,custom[email]] form-control" name="email" >
                          </div>
                    </div>
                    
                   <div class="control-group">  
                        <label class="control-label span2" for="ref_article">Mot de passe :</label>
                          <div class="controls">
                            <input type="password" value="" class="validate[required] form-control" name="password" >
                          </div>
                    </div>
                    
                    <div class="control-group">  
                            <label class="control-label span2" for="designation">Type de compte :</label>
                            <div class="controls">
		 						<select class="validate[required] form-control" id="sport" name="account_type">
                                <option value="">Type du compte</option>
                           		<option value="admin">Administrateur</option>
                                <option value="user">Gestionnaire</option>
                                 
                            </select>	
                            </div>
                    </div>      
                     <!-- /.control-group -->
                    </div>
                    </div>
                    <input class="span3 btn btn-primary" type="submit" value="Ajouter" style="margin-bottom:1em; float: right;">
                   </form>
				</div>
				<!-- /block -->
				
			</div>
		</div>
	</div>
	<hr>
</div>
<?php
include ("template/footer_form.php");
?>